<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>main</title>
<jsp:include page="../../pages/head.jsp" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=path %>/js/jquery.combogrid/resources/css/smoothness/jquery-ui-1.10.1.custom.css"/>
<script type="text/javascript" src="<%=path %>/js/jquery.combogrid/resources/jquery/jquery-ui-1.10.1.custom.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="<%=path %>/js/jquery.combogrid/resources/css/smoothness/jquery.ui.combogrid.css"/>
<script type="text/javascript" src="<%=path %>/js/jquery.combogrid/resources/plugin/jquery.ui.combogrid-1.6.3.js"></script>
<script type="text/javascript">
	function save(){
		if (!checkForm(document.getElementById("saveForm"))) {
			return;
		}
		xbox.load("loading");	
		$("#saveForm").ajaxSubmit(function(data){
	   		if(data==null){
				xbox.ready("loading");
				var input = $("#clientLevelName");
				addError(input,'客户级别名称:"'+input.val()+'"已经存在,请重新输入.');
			}
			else
	 	  		$("#refreshForm").submit();
	    });
	}
	function turnBack(){
		xbox.load("loading");
	   $("#refreshForm").submit();
	}
	$(function(){
		$( "#realName" ).combogrid({
			url: '<%=path%>/user/userAjax_query4AutoComplete_resourceAction.action',
			debug:false,
	    	//replaceNull: true,
			colModel: [{'columnName':'id','width':'15','label':'编号'}, {'columnName':'name','width':'40','label':'员工姓名'},{'columnName':'departmentName','width':'40','label':'所属部门'}],
			select: function( event, ui ) {
				$("#realName").val(ui.item.name);
				$("#userId").val(ui.item.id);
				return false;
			},
			inputSpace:function(){
				$("#userId").val("");
			}
		});
	});

</script>

</head>
<body>
<form action="<%=path%>/clientLevel/clientLevelAjax_modify_clientLevelAction.action" method="post" id="saveForm">
<table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" bgcolor="#F1F1F1" style="margin-bottom:8px">
  <tr bgcolor="#FFFFFF">
    <td colspan="2" height="16"><span></span></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td width="45%" align="right" bgcolor="#FFFFFF"><span style="color:red;">*</span>客户级别名称：</td>
    <td width="55%" align="left" bgcolor="#FFFFFF">
              <input maxlength="25" type="text" name="clientLevel.clientLevelName" id="clientLevelName" isNull="客户级别名称" value="${clientLevel.clientLevelName}" />
    </td>
  </tr>
  <tr align="right" bgcolor="#F1F1F1">
	<td height="36" colspan="2" align="center">
		<input type='button' class="btn btn-primary" id="btnSave" onclick="save();" value='保存' />
	    &nbsp;<input type='button' class="btn" onclick="turnBack();" value='返回' />
</td>
</tr>
</table>
<input type="hidden" name="clientLevel.clientLevelId" id="clientLevelId" value="${clientLevel.clientLevelId}" />
<input type="hidden" name="clientLevel.deleteFlag" id="deleteFlag" value="${clientLevel.deleteFlag}" />
</form>

<form action="${listUrl}" method="post" style="display: none;" id="refreshForm" name="refreshForm"/>

</body>
</html>
